unit SetCoordinates;

interface

uses
  Database,
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ExtCtrls, ColorGrd, Mask, JvExMask, JvSpin;

type
  TFormSetCoordinates = class(TForm)
    BtnOK: TBitBtn;
    BtnCancel: TBitBtn;
    Label8: TLabel;
    Label12: TLabel;
    Label1: TLabel;
    EditMap: TComboBox;
    EditX: TJvSpinEdit;
    EditY: TJvSpinEdit;
    procedure BtnCancelClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BtnOKClick(Sender: TObject);
    procedure EditXExit(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    start: boolean;
  end;

implementation
uses
   DBClient;

{$R *.DFM}

procedure TFormSetCoordinates.FormCreate(Sender: TObject);
var table: TClientDataset;
begin
  start:=false;
  table:=TClientDataset.create(self);
  with table do begin
    CloneCursor(Datawell.TableMaps, false);
    active:=true;
    first;
    while not EOF do begin
      EditMap.items.add(fieldbyname('Map').asstring);
      next;
    end;
  end;
  table.free;
  if EditMap.items.count > 0 then EditMap.itemindex:=0;
end;

procedure TFormSetCoordinates.BtnCancelClick(Sender: TObject);
begin
  close;
end;

procedure TFormSetCoordinates.BtnOKClick(Sender: TObject);
begin
  start:=true;
  close;
end;

procedure TFormSetCoordinates.EditXExit(Sender: TObject);
var
   spin: TJvSpinEdit absolute sender;
begin
  if not (sender is TJvSpinEdit) then
     Exit;
  if spin.value < -9999 then spin.value:=-9999;
  if spin.value > 9999 then spin.value:=9999;
end;

end.

